import https from "./http";
import qs from "qs";
import {config} from "./apiConfig";

// const ip = "http://11.23.254.120";
// const ip = "http://base.kingborn.org:27002";
const apiUrl = process.env.NODE_ENV == "development" ? "/api" : `${config.ip}/auth-admin/`;
const apiuserNUrl = process.env.NODE_ENV == "development" ? "/userN" : `${config.ip}/auth-resource/`;

// 获取菜单栏
export function getLeftMenu(query) {
  return https({
    url: `./static/json/leftMenu.json`,
    method: 'get',
    params: query
  })
}

// 获取用户信息
export function getUserN(query) {
  return https({
    url: `${apiuserNUrl}/user`,
    method: 'get',
    headers: {
      sendKey: "getUserN"
    },
    params: query
  })
}

// 登录
export function login(data) {
  return https({
    url: `${apiUrl}/pwdLogin`,
    method: 'post',
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
      sendKey: "login"
    },
    data: qs.stringify(data)
  })
}


